"use strict";
const { Model } = require("sequelize");
module.exports = (sequelize, DataTypes) => {
  class GoodsRecord extends Model {
    /**
     * Helper method for defining associations.
     * This method is not a part of Sequelize lifecycle.
     * The `models/index` file will call this method automatically.
     */
    static associate(models) {
      // define association here
    }
  }
  GoodsRecord.init(
    {
      applyId: DataTypes.INTEGER,
      personId: DataTypes.INTEGER,
      status: DataTypes.INTEGER,
      remark: DataTypes.TEXT,
    },
    {
      sequelize,
      modelName: "GoodsRecord",
    }
  );
  GoodsRecord.associate = function (models) {
    models.GoodsRecord.belongsTo(models.User, {
      foreignKey: "personId", // 本章表里面的id
      targetKey: "id", //
    });
  };
  return GoodsRecord;
};
